function _defineProperty(a, t, e) {
    return t in a ? Object.defineProperty(a, t, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[t] = e, a;
}

var app = getApp();

Page(_defineProperty({
    data: {
        cardid: 0
    },
    onLoad: function(a) {
        var t = this, e = a.cardid;
        t.setData({
            cardId: e
        }), 0 < e && app.util.request({
            url: "entry/wxapp/GetCard",
            data: {
                m: "bbyscm_card",
                cardid: e
            },
            success: function(a) {
                0 == a.data.errno && t.setData({
                    card_info: a.data.data,
                    cardid: a.data.data.id
                });
            }
        }), app.util.request({
            url: "entry/wxapp/Setup",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                t.setData({
                    setup: a.data.data,
                    apikey: a.data.data.apikey
                });
            }
        });
    },
    onShareAppMessage: function() {},
    onReady: function() {},
    onShow: function() {
        var t = this;
        app.globalData.hasLogin ? t.setData({
            userInfo: app.globalData.userInfo
        }) : app.util.getUserInfo(function(a) {
            app.globalData.hasLogin = !0, t.setData({
                userInfo: a
            }), app.globalData.userInfo = a;
        });
    },
    postCard: function(a) {
        var t = this;
        t.setData({
            btn_disabled: !0,
            submitIsLoading: !0
        }), JSON.stringify(a.detail.value);
        var e = a.detail.formId, n = t.data.cardid, o = a.detail.value.mobile2, i = a.detail.value.weixin, s = a.detail.value.qq, d = a.detail.value.email, c = a.detail.value.weibo, r = a.detail.value.desc;
        if (!n) return wx.showModal({
            title: "提示",
            content: "获取信息失败",
            showCancel: !1,
            success: function(a) {
                a.confirm, t.setData({
                    btn_disabled: !1,
                    submitIsLoading: !1
                });
            }
        }), !1;
        wx.showToast({
            title: "提交中...",
            icon: "loading",
            duration: 1e4
        }), app.util.request({
            url: "entry/wxapp/PostCardM",
            data: {
                m: "bbyscm_card",
                form_id: e,
                cardid: n,
                mobile2: o,
                weixin: i,
                qq: s,
                email: d,
                weibo: c,
                desc: r
            },
            method: "POST",
            success: function(a) {
                0 == a.data.errno ? wx.showModal({
                    title: "提示",
                    content: "提交成功",
                    showCancel: !1,
                    success: function(a) {
                        wx.navigateBack();
                    }
                }) : wx.showModal({
                    title: "提示",
                    content: a.data.message,
                    showCancel: !1,
                    success: function(a) {
                        a.confirm;
                    }
                });
            },
            fail: function(a) {
                wx.showModal({
                    title: "提示",
                    content: a.data.message,
                    showCancel: !1,
                    success: function(a) {
                        a.confirm;
                    }
                });
            },
            complete: function() {
                wx.hideToast();
            }
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
}, "onShareAppMessage", function() {}));